package com.ruoyi.spectrum.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.spectrum.mapper.SampleSpectrumPelMapper;
import com.ruoyi.spectrum.domain.SampleSpectrumPel;
import com.ruoyi.spectrum.service.ISampleSpectrumPelService;

/**
 * 制粒车间样品光谱Service业务层处理
 * 
 * @author weihanqiang
 * @date 2025-05-02
 */
@Service
public class SampleSpectrumPelServiceImpl implements ISampleSpectrumPelService 
{
    @Autowired
    private SNUtil snUtil;
    @Autowired
    private SampleSpectrumPelMapper sampleSpectrumPelMapper;

    /**
     * 查询制粒车间样品光谱
     * 
     * @param sampleSpectrumPelId 制粒车间样品光谱主键
     * @return 制粒车间样品光谱
     */
    @Override
    public SampleSpectrumPel selectSampleSpectrumPelBySampleSpectrumPelId(Long sampleSpectrumPelId)
    {
        return sampleSpectrumPelMapper.selectSampleSpectrumPelBySampleSpectrumPelId(sampleSpectrumPelId);
    }

    /**
     * 查询制粒车间样品光谱列表
     * 
     * @param sampleSpectrumPel 制粒车间样品光谱
     * @return 制粒车间样品光谱
     */
    @Override
    public List<SampleSpectrumPel> selectSampleSpectrumPelList(SampleSpectrumPel sampleSpectrumPel)
    {
        return sampleSpectrumPelMapper.selectSampleSpectrumPelList(sampleSpectrumPel);
    }

    /**
     * 新增制粒车间样品光谱
     * 
     * @param sampleSpectrumPel 制粒车间样品光谱
     * @return 结果
     */
    @Override
    public int insertSampleSpectrumPel(SampleSpectrumPel sampleSpectrumPel)
    {
        String sample_spectrum_pel_no = snUtil.generateSN("sample_spectrum_pel", "sample_spectrum_pel_no", "yyyyMMdd", "ZLA", 4);
        sampleSpectrumPel.setSampleSpectrumPelNo(sample_spectrum_pel_no);
        sampleSpectrumPel.setCreateTime(DateUtils.getNowDate());
        return sampleSpectrumPelMapper.insertSampleSpectrumPel(sampleSpectrumPel);
    }

    /**
     * 修改制粒车间样品光谱
     * 
     * @param sampleSpectrumPel 制粒车间样品光谱
     * @return 结果
     */
    @Override
    public int updateSampleSpectrumPel(SampleSpectrumPel sampleSpectrumPel)
    {
        return sampleSpectrumPelMapper.updateSampleSpectrumPel(sampleSpectrumPel);
    }

    /**
     * 批量删除制粒车间样品光谱
     * 
     * @param sampleSpectrumPelIds 需要删除的制粒车间样品光谱主键
     * @return 结果
     */
    @Override
    public int deleteSampleSpectrumPelBySampleSpectrumPelIds(Long[] sampleSpectrumPelIds)
    {
        return sampleSpectrumPelMapper.deleteSampleSpectrumPelBySampleSpectrumPelIds(sampleSpectrumPelIds);
    }

    /**
     * 删除制粒车间样品光谱信息
     * 
     * @param sampleSpectrumPelId 制粒车间样品光谱主键
     * @return 结果
     */
    @Override
    public int deleteSampleSpectrumPelBySampleSpectrumPelId(Long sampleSpectrumPelId)
    {
        return sampleSpectrumPelMapper.deleteSampleSpectrumPelBySampleSpectrumPelId(sampleSpectrumPelId);
    }
}
